package com.xjm.bean.imports;

import org.springframework.beans.factory.support.BeanDefinitionRegistry;
import org.springframework.context.annotation.ImportBeanDefinitionRegistrar;
import org.springframework.core.type.AnnotationMetadata;

import java.util.logging.Logger;

/**
 * 通过实现ImportBeanDefinitionRegistrar来触发Spring的回调  <br>
 * 注意，需要通过@Import进行导入.
 *
 * @author jaymin
 * 2021/3/13 21:48
 */
public class NeedImportBean implements ImportBeanDefinitionRegistrar{

	@Override
	public void registerBeanDefinitions(AnnotationMetadata importingClassMetadata, BeanDefinitionRegistry registry) {
		Logger.getGlobal().info("Through implements ImportBeanDefinitionRegistrar and @Import to callback me.");
	}

	public void doSomething(){
		Logger.getGlobal().info("Through @Import registry to a bean ");
	}

}
